import React from 'react';
import { View, Text } from '@tarojs/components';
import i18n from 'i18n-js';
import { GStyleSheet, DynamicColors } from '@/utils/DarkMode';

const dstyles = GStyleSheet.create({
  alertText: {
    color: DynamicColors.alertColor
  },
  faultText: {
    color: DynamicColors.faultColor
  },
  notiText: {
    color: DynamicColors.subTitleTextColor
  }
});

interface IProps {
  msgType: number
}

export default class NotiTypeText extends React.Component<IProps> {
  render() {
    const styles = dstyles.style;
    const { msgType } = this.props;
    let subTitle = <View />
    if (msgType === 1) {
      subTitle = <Text style={styles.alertText}>{`【${i18n.t('WARN')}】`}</Text>;
    } else if (msgType === 2) {
      subTitle = <Text style={styles.faultText}>{`【${i18n.t('FAULT')}】`}</Text>;
    } else {
      subTitle = <Text style={styles.notiText}>{`【${i18n.t('NOTI')}】`}</Text>;
    }
    return subTitle;
  }
}
